<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title>TOUPROPRE DBMS - Browser</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" media="screen" type="text/css" title="Design" href="styles/design.css" />
</head>

<body>
    <!-- TITLE  -->
	<div id="page_title">
      <h1>Custom Search</h1>
    </div>

    <!-- Side Menues -->
    <?php include "tools/Menues.html"; ?>

    <!-- Main Body -->
    <div id="page_body">
<?php 
include "tools/Queries.php";
function ShowNewQueryLink() {   
    echo '<a href=browse_custom.php>New Query</a>';
}

if(isset($_POST['submit'])) {
    // Build Query and Display :
    $sql = 'SELECT ' . $_POST['cmd'];
    
    EchoSelectQuery($sql);
    
    ShowNewQueryLink();
 }
 else {
      echo '<p class="text">Here you may enter a custom MySQL command to
    perform a search. You can view the <a target="_blank"
    href="http://dev.mysql.com/doc/refman/5.0/en/select.html">MySQL
    Documentation</a> for more info.</p>';
     echo "\n<form class='form' action='browse_custom.php' method='post'>";
     echo "\n<p class='sql_cmd'>MySQL > SELECT ";
     echo "<td width=120><input type='text' name='cmd' size='50'></td></tr>";
     echo "<input type='submit' name='submit' value='Search'/>";
     echo "\n</p></form><br/><br/>";
 }
?>
    </div>
    
    <!-- Footer -->
    <?php include "tools/Footer.html"; ?>
</body>
</html>
